<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>简介</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="book.sem.html">« Semaphore</a></li>
      <li style="float: right;"><a href="sem.setup.html">安装/配置 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.sem.html">Semaphore</a></li>
    <li>简介</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="intro.sem" class="preface">
  <h1 class="title">简介</h1>
  <p class="para">
   These modules provide wrappers for the System V IPC family of functions.
   It includes semaphores, shared memory and inter-process messaging (IPC).
  </p>
  <p class="para">
   Semaphores may be used to provide exclusive access to
   resources on the current machine, or to limit the number of
   processes that may simultaneously use a resource.
  </p>
  <p class="para">
   This module provides also shared memory functions using System V
   shared memory. Shared memory may be used to provide access to
   global variables. Different httpd-daemons and even other programs
   (such as Perl, C, ...) are able to access this data to provide a
   global data-exchange. Remember, that shared memory is NOT safe
   against simultaneous access. Use semaphores for synchronization.
   <table class="doctable table">
    <caption><strong>Limits of Shared Memory by the Unix OS</strong></caption>
    
     <tbody class="tbody">
      <tr>
       <td>SHMMAX</td> 
       <td>max size of shared memory, normally 131072 bytes</td>
      </tr>

      <tr>
       <td>SHMMIN</td>
       <td>minimum size of shared memory, normally 1 byte</td>
      </tr>

      <tr>
       <td>SHMMNI</td> 
       <td>
        max amount of shared memory segments on a system,
        normally 100
       </td>
      </tr>

      <tr>
       <td>SHMSEG</td>
       <td>
        max amount of shared memory segments per process, normally 6
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   The messaging functions may be used to send and receive messages to/from
   other processes. They provide a simple and effective means of exchanging
   data between processes, without the need for setting up an alternative
   using Unix domain sockets.
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    Only the shared memory functions and <span class="function"><a href="function.ftok.html" class="function">ftok()</a></span> are available
    on Windows. Neither semaphores nor inter-process messaging functions are
    supported on that platform.
   </span>
  </p></blockquote>
 </div></div></div></body></html>